const express = require('express');
const router = express.Router();
const recommendController = require('../controllers/recommendationController');

/**
 * @swagger
 * tags:
 *   name: Recommendations
 *   description: 推荐内容相关接口
 */

// 获取热门电影
/**
 * @swagger
 * /recommendations/high-rated-movies:
 *   post:
 *     summary: 获取高分电影推荐（评分≥9且评论数>1）
 *     tags: [Recommendations]
 *     description: 根据评分和评论数筛选高质量电影
 *     requestBody:
 *       required: true
 *       content:
 *         application/json:
 *           schema:
 *             type: object
 *             properties:
 *               page:
 *                 type: integer
 *                 minimum: 1
 *                 default: 1
 *               limit:
 *                 type: integer
 *                 minimum: 1
 *                 maximum: 50
 *                 default: 5
 *     responses:
 *       200:
 *         description: 获取成功
 *         content:
 *           application/json:
 *             example:
 *               data:
 *                 - id: 1
 *                   title: "肖申克的救赎"
 *                   rating: 9.3
 *                   count_reviews: 1500
 *                   poster_url: "https://example.com/poster1.jpg"
 *               total: 20
 *               page: 1
 *               limit: 5
 *       500:
 *         description: 服务器内部错误
 */
router.post('/high-rated-movies', recommendController.getHighRatedMovies);

// 获取热门影评
/**
 * @swagger
 * /recommendations/high-rated-reviews:
 *   post:
 *     summary: 获取热门影评推荐（评分≥9.5且点赞≥100）
 *     tags: [Recommendations]
 *     description: 获取高质量用户影评（包含用户和电影信息）
 *     requestBody:
 *       required: true
 *       content:
 *         application/json:
 *           schema:
 *             type: object
 *             properties:
 *               page:
 *                 type: integer
 *                 minimum: 1
 *                 default: 1
 *               limit:
 *                 type: integer
 *                 minimum: 1
 *                 maximum: 50
 *                 default: 5
 *     responses:
 *       200:
 *         description: 获取成功
 *         content:
 *           application/json:
 *             example:
 *               data:
 *                 - id: 123
 *                   content: "这是一部令人震撼的经典之作..."
 *                   user_rating: 9.8
 *                   likes: 250
 *                   username: "影评达人"
 *                   title: "教父"
 *                   poster_url: "https://example.com/poster2.jpg"
 *               total: 15
 *               page: 1
 *               limit: 5
 *       500:
 *         description: 服务器内部错误
 */
router.post('/high-rated-reviews', recommendController.getHighRatedReviews);

module.exports = router;